|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
AbstractActivity.java | 50% | 53.6% | 35.3% | 46.9% |
|
1 |
/*
|
|
2 |
* $Id: AbstractActivity.java,v 1.1 2004/12/15 14:18:13 patforna Exp $
|
|
3 |
*
|
|
4 |
* Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
|
|
5 |
* Berne University of Applied Sciences
|
|
6 |
* School of Engineering and Information Technology
|
|
7 |
* All rights reserved.
|
|
8 |
*/
|
|
9 |
package bexee.model.activity.impl;
|
|
10 |
|
|
11 |
import java.util.ArrayList;
|
|
12 |
import java.util.List;
|
|
13 |
|
|
14 |
import bexee.model.InvalidValueException;
|
|
15 |
import bexee.model.StandardAttributes;
|
|
16 |
import bexee.model.activity.Activity;
|
|
17 |
import bexee.model.elements.Source;
|
|
18 |
import bexee.model.elements.Target;
|
|
19 |
import bexee.model.expression.BooleanExpression;
|
|
20 |
import bexee.model.expression.impl.BooleanExpressionImpl;
|
|
21 |
import bexee.util.BooleanUtils;
|
|
22 |
import bexee.util.StringUtils;
|
|
23 |
|
|
24 |
/**
|
|
25 |
* This is an abstract class to be used by all BPEL Activity implementations.
|
|
26 |
*
|
|
27 |
* @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:13 $
|
|
28 |
* @author Patric Fornasier
|
|
29 |
* @author Pawel Kowalski
|
|
30 |
*/
|
|
31 |
public abstract class AbstractActivity implements Activity { |
|
32 |
|
|
33 |
private String name = null; |
|
34 |
|
|
35 |
private BooleanExpression joinExpression = null; |
|
36 |
|
|
37 |
private boolean suppressJoinFailure = false; |
|
38 |
|
|
39 |
private List targets = null; |
|
40 |
|
|
41 |
private List sources = null; |
|
42 |
|
|
43 |
private Object accessorElement = null; |
|
44 |
|
|
45 |
//**************************************************/
|
|
46 |
// c'tors
|
|
47 |
//**************************************************/
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Create a new AbstractActivity.
|
|
51 |
*
|
|
52 |
*/
|
|
53 | 0 |
public AbstractActivity() {
|
54 | 0 |
this(null); |
55 |
} |
|
56 |
|
|
57 |
/**
|
|
58 |
* Create a new AbstractActivity with the given StandardAttributes.
|
|
59 |
*
|
|
60 |
* @param standardAttributes
|
|
61 |
*/
|
|
62 | 266 |
public AbstractActivity(StandardAttributes standardAttributes) {
|
63 | 266 |
init(); |
64 |
|
|
65 | 266 |
if (standardAttributes != null) { |
66 | 160 |
name = standardAttributes.getName(); |
67 | 160 |
joinExpression = new BooleanExpressionImpl(standardAttributes
|
68 |
.getJoinCondition()); |
|
69 | 160 |
suppressJoinFailure = getValidValueOrDefault(standardAttributes |
70 |
.getSuppressJoinFailure(), DEFAULT_SUPPRESS_JOIN_FAILURE); |
|
71 |
} else {
|
|
72 | 106 |
name = "";
|
73 | 106 |
suppressJoinFailure = DEFAULT_SUPPRESS_JOIN_FAILURE; |
74 |
} |
|
75 |
} |
|
76 |
|
|
77 | 266 |
private void init() { |
78 | 266 |
targets = new ArrayList();
|
79 | 266 |
sources = new ArrayList();
|
80 |
} |
|
81 |
|
|
82 |
//**************************************************/
|
|
83 |
// bexee.model.activity.Activity
|
|
84 |
//**************************************************/
|
|
85 |
|
|
86 | 42 |
public void setName(String name) { |
87 | 42 |
this.name = name;
|
88 |
} |
|
89 |
|
|
90 | 64 |
public String getName() {
|
91 | 64 |
return name;
|
92 |
} |
|
93 |
|
|
94 | 0 |
public void setJoinExpression(BooleanExpression joinExpression) { |
95 | 0 |
this.joinExpression = joinExpression;
|
96 |
} |
|
97 |
|
|
98 | 0 |
public BooleanExpression getJoinExpression() {
|
99 | 0 |
return joinExpression;
|
100 |
} |
|
101 |
|
|
102 | 0 |
public void setSuppressJoinFailure(boolean suppressJoinFailure) { |
103 | 0 |
this.suppressJoinFailure = suppressJoinFailure;
|
104 |
} |
|
105 |
|
|
106 | 22 |
public boolean isSuppressJoinFailure() { |
107 | 22 |
return suppressJoinFailure;
|
108 |
} |
|
109 |
|
|
110 | 0 |
public void addSource(Source source) { |
111 | 0 |
sources.add(source); |
112 |
} |
|
113 |
|
|
114 | 0 |
public void setSources(List sources) { |
115 | 0 |
this.sources = sources;
|
116 |
} |
|
117 |
|
|
118 | 0 |
public List getSources() {
|
119 | 0 |
return sources;
|
120 |
} |
|
121 |
|
|
122 | 0 |
public void addTarget(Target target) { |
123 | 0 |
targets.add(target); |
124 |
} |
|
125 |
|
|
126 | 0 |
public void setTargets(List targets) { |
127 | 0 |
this.targets = targets;
|
128 |
} |
|
129 |
|
|
130 | 0 |
public List getTargets() {
|
131 | 0 |
return targets;
|
132 |
} |
|
133 |
|
|
134 |
//**************************************************/
|
|
135 |
// helper methods
|
|
136 |
//**************************************************/
|
|
137 |
|
|
138 | 0 |
protected String getValidValueOrDefault(String value, String defaultValue) {
|
139 | 0 |
if (StringUtils.isNullOrEmpty(value)) {
|
140 | 0 |
return defaultValue;
|
141 |
} else {
|
|
142 | 0 |
return value;
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 | 210 |
protected boolean getValidValueOrDefault(String value, boolean defaultValue) { |
147 | 210 |
try {
|
148 | 210 |
return BooleanUtils.strictYesNoToBoolean(value);
|
149 |
} catch (InvalidValueException e) {
|
|
150 | 180 |
return defaultValue;
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
} |
|